﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeBase
    {
        public MinorTicks GetMinorTicks()
        {
            MinorTicks minorTicks = new MinorTicks();
            minorTicks.Visibility = IsMinorTicksEnabled ? Visibility.Visible : Visibility.Collapsed;
            minorTicks.Background = MinorTicksBackground==null? null : MinorTicksBackground.Brush;
            minorTicks.BorderBrush = MinorTicksBorderBrush==null? null : MinorTicksBorderBrush.Brush;
            minorTicks.BorderThickness = MinorTicksBorderThickness;
            minorTicks.Placement = MinorTicksPlacement;
            minorTicks.Shape = MinorTicksShape;
            minorTicks.TickLength = MinorTicksTickLength;
            minorTicks.TickWidth = MinorTicksTickWidth;

            return minorTicks;
        }
        private BrushEx minorTicksBackground;
        private BrushEx minorTicksBorderBrush;
        private Thickness minorTicksBorderThickness;
        private PlacementTypes minorTicksPlacement;
        private Shapes minorTicksShape;
        private double? minorTicksTickLength;
        private double? minorTicksTickWidth;

        [Category("次要刻度")]
        [DisplayName("次要刻度背景颜色")]
        [Description("MinorTicksBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MinorTicksBackground", "次要刻度背景颜色")]
        public BrushEx MinorTicksBackground
        {
            get
            {
                return minorTicksBackground;
            }

            set
            {
                minorTicksBackground = value;
                Refresh();
            }
        }

        [Category("次要刻度")]
        [DisplayName("次要刻度边框颜色")]
        [Description("MinorTicksBorderBrush")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MinorTicksBorderBrush", "次要刻度边框颜色")]
        public BrushEx MinorTicksBorderBrush
        {
            get
            {
                return minorTicksBorderBrush;
            }

            set
            {
                minorTicksBorderBrush = value;
                Refresh();
            }
        }

        [Category("次要刻度")]
        [DisplayName("次要刻度边框大小")]
        [Description("MinorTicksBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MinorTicksBorderThickness", "次要刻度边框大小")]
        public Thickness MinorTicksBorderThickness
        {
            get
            {
                return minorTicksBorderThickness;
            }

            set
            {
                minorTicksBorderThickness = value;
                Refresh();
            }
        }

        [Category("次要刻度")]
        [DisplayName("次要刻度位置")]
        [Description("MinorTicksPlacement")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XPlacementTypesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MinorTicksPlacement", "次要刻度位置")]
        public PlacementTypes MinorTicksPlacement
        {
            get
            {
                return minorTicksPlacement;
            }

            set
            {
                minorTicksPlacement = value;
                Refresh();
            }
        }


        [Category("次要刻度")]
        [DisplayName("次要刻度形状")]
        [Description("MinorTicksShape")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XShapesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MinorTicksShape", "次要刻度形状")]
        public Shapes MinorTicksShape
        {
            get
            {
                return minorTicksShape;
            }

            set
            {
                minorTicksShape = value;
                Refresh();
            }
        }

        [Category("次要刻度")]
        [DisplayName("次要刻度长度")]
        [Description("MinorTicksTickLength")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MinorTicksTickLength", "次要刻度长度")]
        public double? MinorTicksTickLength
        {
            get
            {
                return minorTicksTickLength;
            }

            set
            {
                minorTicksTickLength = value;
                Refresh();
            }
        }

        [Category("次要刻度")]
        [DisplayName("次要刻度宽度")]
        [Description("MinorTicksTickWidth")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MinorTicksTickWidth", "次要刻度宽度")]
        public double? MinorTicksTickWidth
        {
            get
            {
                return minorTicksTickWidth;
            }

            set
            {
                minorTicksTickWidth = value;
                Refresh();
            }
        }
        [Category("次要刻度")]
        [DisplayName("次要刻度是否显示")]
        [Description("IsMinorTicksEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "IsMinorTicksEnabled", "次要刻度是否显示")]
        public bool IsMinorTicksEnabled
        {
            get
            {
                return isMinorTicksEnabled;
            }

            set
            {
                isMinorTicksEnabled = value;
                Refresh();
            }
        }

        private bool isMinorTicksEnabled;
    }
}
